var noteDB = require("./noteDatabaseHandler");
var secure = require("./secure");
function index(req, res) {
	res.setHeader('Content-Type', 'text/plain');
    res.end('QuickNote home page !');
}
exports.index = index;

function login(req, res) {
	res.render('./login.ejs');
}
exports.login = login;

function displayNotes(req, res) {
	var user = secure.getAuthenticatedUser(req, res);
	if (user != null) {
		res.render('./template.ejs', {noteList: noteDB.getAllNotes(null, null, user.id) } );
	} else {
		res.render('./login.ejs');
	}
}
exports.displayNotes = displayNotes;